package com.tansun.easycare.rule.ruleflow.entity;

import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.Length;

import com.tansun.easycare.rule.common.entity.RuleBaseEntity;
import com.tansun.easycare.rule.ruleflow.model.Node;

/**
 * 规则流节点Entity
 *
 * @author lph
 * @version 2017-04-17
 */
public class RuleFlowRects extends RuleBaseEntity<RuleFlowRects> {

    private static final long serialVersionUID = 1L;
    private String manageId;        // 规则模型ID
    private String rectType;        // 节点类型
    private String projectCode;        // 项目编码
    private String version;        // version
    private String rectName;        // rect_name
    private String rectCode;        // 规则节点编号
    private String rectVersion;        //规则节点版本
    private String constaints;        // constaints
    private String nodeId;//节点Id
    private String iscache;//是否缓存
    /**
     * 规则名
     */
    private String modelName;
    /**
     * 规则编号
     */
    private String modelCode;

    public RuleFlowRects() {
        super();
    }

    public RuleFlowRects(Node node) {
        super();
        this.rectType = node.type;
        this.rectName = node.name;
        if (!StringUtils.isEmpty(node.model)) {
            String[] arr = node.model.split("_");
            this.rectCode = arr[0];
            if (arr.length == 2) {
                this.rectVersion = arr[1];
            }
        }
        this.constaints = node.constaints;
    }

    public RuleFlowRects(String id) {
        super(id);
    }

    @Length(min = 0, max = 50, message = "manage_id长度必须介于 0 和 50 之间")
    public String getManageId() {
        return manageId;
    }

    public void setManageId(String manageId) {
        this.manageId = manageId;
    }

    @Length(min = 0, max = 10, message = "rect_type长度必须介于 0 和 10 之间")
    public String getRectType() {
        return rectType;
    }

    public void setRectType(String rectType) {
        this.rectType = rectType;
    }

    @Length(min = 0, max = 50, message = "project_code长度必须介于 0 和 50 之间")
    public String getProjectCode() {
        return projectCode;
    }

    public void setProjectCode(String projectCode) {
        this.projectCode = projectCode;
    }

    @Length(min = 0, max = 10, message = "version长度必须介于 0 和 10 之间")
    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    @Length(min = 0, max = 50, message = "rect_name长度必须介于 0 和 50 之间")
    public String getRectName() {
        return rectName;
    }

    public void setRectName(String rectName) {
        this.rectName = rectName;
    }


    public String getRectCode() {
        return rectCode;
    }

    public void setRectCode(String rectCode) {
        this.rectCode = rectCode;
    }

    public String getRectVersion() {
        return rectVersion;
    }

    public void setRectVersion(String rectVersion) {
        this.rectVersion = rectVersion;
    }

    @Length(min = 0, max = 2000, message = "constaints长度必须介于 0 和 2000 之间")
    public String getConstaints() {
        return constaints;
    }

    public void setConstaints(String constaints) {
        this.constaints = constaints;
    }

    public String getModelName() {
        return modelName;
    }

    public void setModelName(String modelName) {
        this.modelName = modelName;
    }

    public String getModelCode() {
        return modelCode;
    }

    public void setModelCode(String modelCode) {
        this.modelCode = modelCode;
    }

	public String getNodeId() {
		return nodeId;
	}

	public void setNodeId(String nodeId) {
		this.nodeId = nodeId;
	}

	public String getIscache() {
		return iscache;
	}

	public void setIscache(String iscache) {
		this.iscache = iscache;
	}
    
}